home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD ROM Paradise Collection 4
/
CD ROM Paradise Collection 4 1995 Nov.iso
/
graphics
/
3dvect37.zip
/
DXFPATH.BAS
< prev
next >
Wrap
BASIC Source File
|
1994-06-22
|
2KB
|
105 lines
DECLARE FUNCTION ac$ (gg!)
' DXFTOPATH - version 1
' date 01/19/94
' The only thing I would like to be changed in this is the way the output
' is formated when you get numbers in scientific notation. eg 2.665e+08
nn = 5000
DIM x(nn), y(nn), z(nn)
nx = 1
CLS
INPUT " Input filename (test.dxf):", a$
INPUT "Output filename (test.asc):", b$
PRINT
PRINT " Input movement method:"
PRINT
PRINT " 1) Variable speed: move, wait_for lc - good for camera"
PRINT " 2) Constant speed: point_time, wait_for ac - good for spaceships"
PRINT
INPUT " Method:", m
PRINT
IF m = 1 THEN INPUT " Time between points (150):", vt
IF m = 2 THEN INPUT " Turn time (10):", tt
IF m = 2 THEN INPUT " Speed of object (15000):", tf
IF vt = 0 THEN vt = 150
IF tt = 0 THEN tt = 10
IF tf = 0 THEN tf = 15000
IF a$ = "" THEN a$ = "test.dxf"
IF b$ = "" THEN b$ = "test.asc"
OPEN a$ FOR INPUT AS #1
ON ERROR GOTO errorthing
OPEN b$ FOR OUTPUT AS #2
testagain:
INPUT #1, a$
IF INSTR(a$, "POLYLINE") <> 0 THEN GOSUB morevertexs
IF INSTR(a$, "EOF") <> 0 THEN GOTO outputit
GOTO testagain
outputit:
FOR z = 1 TO nx - 1
ON m GOSUB method1, method2
NEXT z
errorthing:
END
morevertexs:
INPUT #1, a$
IF EOF(1) = -1 THEN GOTO outa
IF INSTR(a$, "EOF") <> 0 THEN GOTO outa
IF INSTR(a$, "VERTEX") <> 0 THEN GOSUB getvertex: GOTO morevertexs
IF INSTR(a$, "SEQEND") <> 0 THEN GOTO outa
GOTO morevertexs
outa:
RETURN
getvertex:
INPUT #1, x$
IF VAL(x$) = 10 THEN INPUT #1, x$: x(nx) = VAL(x$)
IF VAL(x$) = 20 THEN INPUT #1, x$: y(nx) = VAL(x$)
IF VAL(x$) = 30 THEN INPUT #1, x$: z(nx) = VAL(x$)
IF VAL(x$) = 70 THEN nx = nx + 1: RETURN
GOTO getvertex
method1:
IF z <> 1 THEN
PRINT #2, " move "; ac$(x(z)); ","; ac$(y(z)); ","; ac$(z(z)); ","; ac$(vt)
PRINT #2, " wait_for lc,0"
ELSE
PRINT #2, " location "; ac$(x(z)); ","; ac$(y(z)); ","; ac$(z(z))
END IF
RETURN
method2:
IF z <> 1 THEN
GOSUB findzx
PRINT #2, " point_obj "; ac$(x(z)); ","; ac$(y(z)); ","; ac$(z(z)); ","; ac$(tt)
PRINT #2, " wait_for frame_r,"; ac$(INT(zx / tf))
ELSE
PRINT #2, " location "; ac$(x(z)); ","; ac$(y(z)); ","; ac$(z(z))
PRINT #2, " align_d "; ac$(tf)
END IF
RETURN
findzx:
zx = (x(z) - x(z - 1)) ^ 2
zx = (y(z) - y(z - 1)) ^ 2 + zx
zx = (z(z) - z(z - 1)) ^ 2 + zx
zx = SQR(zx)
RETURN
FUNCTION ac$ (gg)
ac$ = LTRIM$(RTRIM$(STR$(gg)))
END FUNCTION